﻿





using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using LightEffects;
using SpecialEffects;
using GlobalGameClasses;
using DrawableObjects.Actors.Aircrafts;

namespace DrawableObjects.Actors.Projectiles
{
    public class Lightning : Projectile
    {
        /// <summary>
        /// this class creates the different level of weapons of the weaponsystem "lightning"
        /// it also creates the enemy weapon
        /// </summary>
        private Lightning(float speed, int baseDamage, string strTextureModel, Matrix worldMatrix, float scaleFactor, float boundingFactor, string explosionSound)
            : base(speed, baseDamage, strTextureModel, worldMatrix, scaleFactor, boundingFactor, explosionSound)
        {
            this.strTextureModel = strTextureModel;
        }

        public static Lightning GET_LIGHTNING_BOSS()
        {
            return new Lightning(0.5f, 15, "boss_energyball", Matrix.CreateWorld(new Vector3(0, GlobalGameValues.GAMEFIELD_HEIGHT, 0), Vector3.Backward, Vector3.Up), 0.4f, 1, "missileExplosion");
        }

        public override void collide(Actor actor2)
        {
            base.collide(actor2);
            if (actor2.owner != this.owner && actor2 is Aircraft)
            {
                world.addSpecialEffect(BasicExplosion.CreateSmokeExpl_Enemy(worldMatrix.Translation, Vector3.Zero, (float)GlobalGameValues.Values.gameTime.TotalGameTime.TotalMilliseconds));
                world.addSpecialEffect(BasicExplosion.CreateExpl_Enemy1(worldMatrix.Translation, Vector3.Zero, (float)GlobalGameValues.Values.gameTime.TotalGameTime.TotalMilliseconds));
            } 
        }

        public override Projectile Clone(Vector2 position, Vector2 direction)
        {
            Matrix newMatrix = this.worldMatrix;
            newMatrix.M41 = position.X;
            newMatrix.M43 = position.Y;
            Lightning cloned = new Lightning(this.speed, this.baseDamage, this.strTextureModel, newMatrix, this.scaleFactor, this.boundingSphereFactor, this.explosionSound);
            cloned.direction = direction;
            cloned.standardRotation = this.standardRotation;
            return cloned;
        }

    }
}

